home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AOCE Sample Code / PowerTalk Access Modules / Sample PMSAM / PMSAM Framework / RoboSamSlot / CRecipientIterator.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-28  |  2.6 KB  |  111 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        CRecipientIterator.h
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Written by:    Tim Harnett
  7.  
  8.     Copyright:    © 1994 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <3>     2/21/95    TMH        metrowerks compatiblity changes
  13.          <2>     1/11/95    TMH        added IsLast()
  14.          <1>     9/20/94    TMH        Abandon RoadsideRest embrace Mercury
  15.                  6/15/94    TMH        xxx put comment here xxx
  16.  
  17.     To Do:
  18. */
  19.  
  20. #ifndef __CRecipientIterator__
  21. #define __CRecipientIterator__
  22.  
  23.  
  24. #ifndef __OCE__
  25. #include "OCE.h"
  26. #endif
  27.  
  28. #ifndef __OCEMESSAGING__
  29. #include "OCEMessaging.h"
  30. #endif
  31.  
  32. #ifndef __OCEMAIL__
  33. #include "OCEMail.h"
  34. #endif
  35.  
  36.  
  37. //-----------------------------------------
  38. //        C R e c i p i e n t I t e r a t o r
  39. //-----------------------------------------
  40.  
  41.  
  42. #define kMaxRecipSize 256
  43.  
  44. // OrigRecipient:
  45. //
  46. // each entry in the recipient array returned by MSAMGetRecipients is of the below
  47. // form when getting original recipients.
  48.  
  49. typedef struct OrigRecipient {
  50.     MailOriginalRecipient    ext;        // the index is all that is interesting
  51.     OCEPackedRecipient        packedRecip;
  52. } OrigRecipient;
  53.  
  54.  
  55.  
  56. class CRecipientIterator {
  57. public:
  58.     CRecipientIterator(MailMsgRef msgRef,MailAttributeID recipientKind);
  59.  
  60.     OrigRecipient*        FirstRecipient();
  61.     Boolean                More();
  62.     OrigRecipient*        NextRecipient();
  63.     virtual void        Advance();
  64.     void                GetMore();
  65.  
  66.     OrigRecipient*        CurrentRecipient()     { return fCurrentRecipientPtr; }
  67.  
  68.     Boolean             IsLast() { return ( ((fGetIndex+1)  == fNumRecipientsReturned) && fPB.more); }
  69.  
  70.     MSAMGetRecipientsPB fPB;
  71.     short                fNumRecipientsReturned;
  72.     short                fGetIndex;
  73.     
  74.     OrigRecipient*        fCurrentRecipientPtr;
  75.     char                fRecipientBuffer[kMaxRecipSize];
  76.     
  77.  
  78. };
  79.  
  80.  
  81.  
  82. //-------------------------------------------------------------
  83. //        C R e s o l v e d R e c i p i e n t I t e r a t o r
  84. //------------------------------------------------------------
  85.  
  86.  
  87.  
  88. //  ResolvedRecipient:
  89. //
  90. // each entry in the recipient array returned by MSAMGetRecipients is of the below
  91. // form when getting resolved recipients.
  92.  
  93. typedef struct ResolvedRecipient {
  94.     MailResolvedRecipient    ext;
  95.     OCEPackedRecipient        packedRecip;
  96. } ResolvedRecipient;
  97.  
  98.  
  99. class CResolvedRecipientIterator : public CRecipientIterator {
  100. public:
  101.     CResolvedRecipientIterator(MailMsgRef msgRef) : CRecipientIterator(msgRef,kMailResolvedList) {};
  102.     
  103.     ResolvedRecipient*        FirstResolvedRecipient()   { return (ResolvedRecipient*) CRecipientIterator::FirstRecipient(); }
  104.     ResolvedRecipient*        NextResolvedRecipient()    { return (ResolvedRecipient*) CRecipientIterator::NextRecipient(); }
  105.     ResolvedRecipient*        CurrentResolvedRecipient() { return (ResolvedRecipient*) fCurrentRecipientPtr; }
  106.     
  107.     virtual void        Advance();
  108. };
  109.  
  110.  
  111. #endif __CRecipientIterator__